home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / strpp300.zip / PARSESTR.H < prev    next >
C/C++ Source or Header  |  1993-04-11  |  2KB  |  55 lines

  1. /* -------------------------------------------------------------------- */
  2. /* String++ Version 3.00                                       04/10/93 */
  3. /*                                                                      */
  4. /* Enhanced string class for Turbo C++/Borland C++.                     */
  5. /* Copyright 1991-1993 by Carl W. Moreland                              */
  6. /*                                                                      */
  7. /* parsestr.h                                                           */
  8. /* -------------------------------------------------------------------- */
  9. /* String-derived class for parsing routines.                           */
  10. /* -------------------------------------------------------------------- */
  11.  
  12. #ifndef _PARSESTR_H
  13. #define _PARSESTR_H
  14.  
  15. #ifdef BCCL
  16. #include "strng.h"
  17. #else
  18. #include "str.h"
  19. #endif
  20.  
  21. class ParseString: public String
  22. {
  23. protected:
  24.   unsigned offset;            // offset for parsing
  25.  
  26. public:
  27.   ParseString();            // default constructor;
  28.   ParseString(const char* p);        // initialize with a char *
  29.   ParseString(const String& s);        // initialize with another String
  30.  ~ParseString(void);
  31.  
  32. protected:
  33.   void SetStr(const char* p);
  34.   void SetStr(const String& s);
  35.   void AddStr(const char c);
  36.   void AddStr(const char* p);
  37.   void AddStr(const String& s);
  38.  
  39. public:
  40.   int  Offset(void) { return offset; }    // return the current offset
  41.   const char* Offset(unsigned n);    // set the absolute offset
  42.   void Reset(void);            // set offset = 0
  43.  
  44.   String& operator=(const char*);    // str1 = char*
  45.   String& operator=(const String&);    // str1 = str
  46.   const char* operator++();        // ++str - increment strPtr
  47.   const char* operator++(int);        // str++ - increment strPtr
  48.   const char* operator--();        // --str - decrement strPtr
  49.   const char* operator--(int);        // str-- - decrement strPtr
  50.   const char* operator+=(const unsigned); // str+=n - increment strPtr
  51.   const char* operator-=(const unsigned); // str-=n - decrement strPtr
  52. };
  53.  
  54. #endif
  55.